/******************************************************************************
 * Copyright (C) 2017 Chengdu Dlhd information industry co. LTD.
 * All Rights Reserved.
 * 本软件为成都顶联互动信息产业有限公司开发研制。未经本公司正式书面同意，其他任何个人、团体不得使用、复制、修改或发布本软件.
 *****************************************************************************/
package net.dgg.dggcloud.service.jrcrm.service.cms;

import net.dgg.dggcloud.core.util.StringUtils;
import net.dgg.dggcloud.service.common.base.service.BaseService;
import net.dgg.dggcloud.service.entity.user.User;
import net.dgg.dggcloud.service.jrcrm.dao.cms.UserSettingDao;
import net.dgg.dggcloud.service.jrcrm.dao.cms.VipCountDao;
import net.dgg.dggcloud.service.jrcrm.entity.cms.UserSetting;
import net.dgg.dggcloud.service.jrcrm.entity.cms.VipCount;
import net.dgg.dggcloud.service.service.user.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Vip设置业务处理
 *
 * @ClassName: UserSettingService
 * @Author: 罗金
 * @Date: 2018年06月02 15:32:27
 * @Version V1.2.2
 */

@Service
public class VipCountService extends BaseService {

    @Autowired
    private VipCountDao vipCountDao;
    @Autowired
    private UserService userService;

    /**
     * 根据条件查询Vip设置列表
     *
     * @param map
     * @return
     */
    public List<Map> queryVipCountListByParams(Map map) {
        return vipCountDao.queryVipCountListByParams(map);
    }

    /**
     * 根据条件查询设置列表
     *
     * @param map
     * @return
     */
    public Integer countVipListByParams(Map map) {
        return vipCountDao.countListVipByParams(map);
    }

    /**
     * 根据id查询单个员工设置信息
     *
     * @param id
     * @return
     */
    public UserSetting queryUserSettingById(Long id) {
        return super.repository.get(UserSetting.class, id);
    }

    /**
     * 更新员工Vip记录设置
     *
     * @param vipCount
     */
    public void updateVipCountByParams(VipCount vipCount) {
        try {
            this.repository.save(vipCount);
        } catch (Exception e) {
            throw new RuntimeException("fail");
        }
    }
}
